<?php


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Short description for file
 *
 * Long description for file (if any)...
 *
 * PHP version 5
 *
 * Copyright 2008 The Picnic PHP Framework
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @category      Framework
 * @package       Pfw
 * @author        Sean Sitter <sean@picnicphp.com>
 * @copyright     2008 The Picnic PHP Framework
 * @license       http://www.apache.org/licenses/LICENSE-2.0
 * @link          http://www.picnicphp.com
 * @since         0.10
 */

class Pfw_Request
{
    protected static $adapter = null;
    
    public static function init($adapter = null) {
        if (!is_null($adapter)) {
            self::$adapter = $adapter;
        } else {
            $adapter_class = "Pfw_Request_Standard";
            Pfw_Loader::loadClass($adapter_class);
            self::$adapter = new $adapter_class();
        }
    }
    
    public static function getAdapter() {
        if (is_null(self::$adapter)) {
            self::init();
        }

        return self::$adapter;
    }
    
    public static function setParams($params)
    {
        return self::getAdapter()->setParams($params);
    }
    
    public static function setParam($name, $value)
    {
        return self::getAdapter()->setParam($name, $value);
    }
    
    public static function getParams()
    {
        return self::getAdapter()->getParams();
    }
    
    public static function getParam($name)
    {
        return self::getAdapter()->getParam($name);
    }
    
    public static function _setHttpMethod($method)
    {
        return self::getAdapter()->_setHttpMethod($method);
    }
    
    public static function isAjax()
    {
        return self::getAdapter()->isAjax();
    }
    
    public static function isHttpPost()
    {
        return self::getAdapter()->isHttpPost();
    }
    
    public static function isRawHttpPost()
    {
        return self::getAdapter()->isRawHttpPost();
    }
    
    public function isHttpGet()
    {
        return self::getAdapter()->isHttpGet();
    }
    
    public function isHttpPut()
    {
        return self::getAdapter()->isHttpPut();
    }
    
    public static function isRawHttpPut()
    {
        return self::getAdapter()->isRawHttpPut();
    }
    
    public function isHttpDelete()
    {
        return self::getAdapter()->isHttpDelete();
    }
    
    public function isHttpHead()
    {
        return self::getAdapter()->isHttpHead();
    }
    
    public function isHttpOption()
    {
        return self::getAdapter()->isHttpOptions();
    }
    
    public static function getHeaderParam($param)
    {
        return self::getAdapter()->getHeaderParam($param);
    }
    
    public static function getHttpMethod()
    {
        return self::getAdapter()->getHttpMethod();
    }
    
    public static function getEntityBody()
    {
        return self::getAdapter()->getEntityBody();
    }
}
